package com.midou.administration.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.midou.administration.bo.OrderAllBo;
import com.midou.administration.bo.ToTheNumberOfDays;
import com.midou.administration.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.midou.administration.entity.OrderInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author MrChen
 * @since 2021-03-24
 */
public interface OrderMapper extends BaseMapper<Order> {

    public List<Order> queryOrder(@Param("page") Page page, @Param("businessId") Integer businessId, @Param("value1")Date value1,@Param("value2")Date value2,@Param("value3")String value3);

    //根据id查询订单 订单中有该订单的订单详情
    List<OrderAllBo> queryOrderAndInfoById(Integer orderId);

    List<Order> queryAll(Integer id);

    /**
     * 根据商户id查找该商户总收入
     * @param
     * @return
     */
    int doUserIdFindAllPrice(@Param("buid") int buid);

    /**
     * 根据商户id查找该商户总订单
     * @param buid
     * @return
     */
    int doUserIdFindAllOrder(@Param("buid") int buid);

    /**
     * 返回最近7天每天的收入
     * @param buid
     * @return
     */
    List<ToTheNumberOfDays> doDayFindAllPrice(@Param("buid") int buid);

    /**
     * 返回最近7天每天的订单量
     * @param buid
     * @return
     */
    List<ToTheNumberOfDays> doDayFindAllOrder(@Param("buid") int buid);

    Order queryOrderByOrderNum(String orderNum);

    /* 订单支付后  将订单状态更改为 1 */
    int updateStateById(@Param("orderNum") int orderNum);

    int count(@Param("date1")Date date1,@Param("date2")Date date2,@Param("id")Integer id);

}
